// 定义一个全局的插件
// $showLoading $hideLoading 
import loadingComponentObj from './loading.vue'
const loading = {
  install (Vue) {
    // 创建了一个组件的构造器
    const loadingTpl = Vue.extend(loadingComponentObj)
    const loadingComponent = new loadingTpl();
    console.log(loadingComponent.$mount().$el)
    // 插入到body上
    document.body.appendChild(loadingComponent.$mount().$el)
    Vue.prototype.$showLoading = ()=>{
      loadingComponent.loading = true
    }
    Vue.prototype.$hideLoading = ()=>{
      loadingComponent.loading = false
    }
  }
}

export default loading